package com.linkwings.dbTemp;

public class ClassUtils {


	public static String getPropertyName(String setterMethodName){
		if(setterMethodName==null){
			return null;
		}
		String str=setterMethodName;
		str=str.trim().toLowerCase();
		if(str.indexOf("set")!=0||str.length()<=3){
			System.err.println("SetterMethod Error: The name ["+setterMethodName+"] of setterMethod error.");
			return null;
		}

		str = str.substring(3);
		String head = String.valueOf(str.charAt(0));
		head = head.toUpperCase();
		return head+str.substring(1);

	}

	public static String getSetterMethodName(String property) {
    	if(property==null||property.length()==0){
    		return null;
    	}
        StringBuffer methodName = new StringBuffer("set");
        String head = String.valueOf(property.charAt(0));
        head = head.toUpperCase();
        methodName.append(head);
        methodName.append(property.substring(1));
        return methodName.toString();
    }

	public static String getGetterMethodName(String property) {
    	if(property==null||property.length()==0){
    		return null;
    	}
        StringBuffer methodName = new StringBuffer("get");
        String head = String.valueOf(property.charAt(0));
        head = head.toUpperCase();
        methodName.append(head);
        methodName.append(property.substring(1));
        return methodName.toString();
    }
}
